﻿@using CoralNode.Core.Entity.Enums
@using CoralNode.MvcClient.Helper
@using Coralcode.Utils.Basic
@model CoralNode.Core.Entity.Domains.Site.SiteDomain

@{
    ViewBag.Title = "Edit";
}
@Html.IncludePage("CoralAdmin/sitesetting", "_Left", new { current = "extension" })
<div id="pbody">
    <div class="extra scrolltab scrolltab-2">
        <div class="pbody_top">
            <span class="ico ico_setting_system"></span><span class="t t_c">网站设置&nbsp;&nbsp;/&nbsp;&nbsp;<b
                class=" t_small f_no">扩展信息</b></span>
        </div>
        <div id="main">
            <div class="extra_normal scrolltab-triggers">
                @foreach (var group in @ViewBag.SiteExtendGroupList) {
                    <a href="javascript:">@group.Title</a>
                }
            </div>
            <form id="spform" action="/m/SiteSetting/siteextensionsetting/@Model.Id" method="post" enctype="multipart/form-data">
                <div class="scrolltab-items pt_2">
                    @foreach (var group in @ViewBag.SiteExtendGroupList) {
                        <div class="table_form form_main  " id="@group.Title">
                            <div class="scrolltab-item-t">
                                <span class="btn"></span>@group.Title
                            </div>
                            <div class="pl_2 pb_3">
                                <table>
                                    <tbody>
                                        @foreach (var item in @group.SiteExtendList) {
                                            <tr>
                                                <th width="80px">@item.Title</th>
                                                <td>
                                                    @if (@item.FieldType == SiteEnums.FieldType.TextField) {
                                           
                                                        <input class="text w_37" type="text" name="field.@item.FieldName" validate="@item.Validator" value="@item.Value" />
                                            
                                                        <div class="exp ml_1">@item.Hint</div>
                                                    } else if (@item.FieldType == SiteEnums.FieldType.TextArea) {
                                                        <textarea name="field.@item.FieldName" validate="@item.Validator" class="h_8 w_37">@item.Value</textarea>
                                                        <div class="exp ml_1">@item.Hint</div>
                                                    } else if (@item.FieldType == SiteEnums.FieldType.PasswordField) {
                                                        <input name="field.@item.FieldName" class="text w_37" type="password" validate="@item.Validator" value="@item.Value"/>
                                                        <div class="exp ml_1">@item.Hint</div>
                                      
                                                    } else if (@item.FieldType == NodeEnums.BasicFieldType.FileField) {
                                                        <input type="hidden" validate="@item.Validator" name="field.@item.FieldName" value="@item.Value"/>
                                                        <ul class="list_img" href="/m/common/upload" data-js="listimg">
                                                            <li class="btn li_add js_openuploader" data-meta="{data:'{module:\' @Model.ThemeCode/@item.FieldName\'}',multi:false,method:'add',type:'file'}">
                                                                <span class="ico ico_upload_file"></span>
                                                            </li>
                                                        </ul>
                                                        <div class="exp ml_1">@item.Hint</div>
                                                    } else if (@item.FieldType == NodeEnums.BasicFieldType.ImageField) {
                                                        <input type="hidden" validate="@item.Validator" name="field.@item.FieldName" value="@item.Value"/>
                                                        <ul class="list_img" href="/m/common/upload" data-js="listimg">
                                                            <li class="btn li_add js_openuploader" data-meta="{data:'{module:\' @Model.ThemeCode/@item.FieldName\'}',multi:false,method:'add',type:'image'}">
                                                                <span class="ico ico_upload_image"></span>
                                                            </li>
                                                        </ul>
                                                        <div class="exp ml_1">@item.Hint</div>
                                                    } else if (@item.FieldType == NodeEnums.BasicFieldType.MultiImage) {
                                                        <input type="hidden" validate="@item.Validator" name="field.@item.FieldName" value="@item.Value"/>
                                                        <ul class="list_img" href="/m/common/upload" data-js="listimg">
                                                            <li class="btn li_add js_openuploader" data-meta="{data:'{module:\' @Model.ThemeCode/@item.FieldName\'}',multi:true,method:'add',type:'image'}">
                                                                <span class="ico ico_upload_image"></span>
                                                            </li>
                                                        </ul>
                                                        <div class="exp ml_1">@item.Hint</div>
                                                    } else {
                                                        <textarea name="field.@item.FieldName" id="@item.FieldName" >@item.Value</textarea>
                                                        <script type="text/javascript">
                                                            UE.getEditor('@item.FieldName')
                                                        </script>
                                                        <div class="exp ml_1">@item.Hint</div>
                                                    }
                                                </td>
                                            </tr>
                                        }
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    }
                </div>
                <div class="submitbox p_2 extra_normal">
                    <input type="submit" class="btn_1" value="提    交" />
                </div>
            </form>
        </div>
    </div>
</div>
